#pragma once

#include "imgui/node/Pin.h"

namespace ImNodes
{
    struct LinkIndex
    {
        bool m_Enable;
        int m_Id;
        int m_StartId, m_EndId;

        LinkIndex(int& index, int startId, int endId)
            :m_Enable(true), m_Id(index++), m_StartId(startId), m_EndId(endId)
        {

        };

    };
    template<typename PinType>
    struct LinkTemp :public ImNodes::LinkIndex
    {
        std::shared_ptr<PinType> m_StartPin, m_EndPin;
        LinkTemp(int& index, std::shared_ptr<PinType> startPin, std::shared_ptr<PinType> endPin) :
            ImNodes::LinkIndex(index, startPin->m_Id, endPin->m_Id),
            m_StartPin(startPin),
            m_EndPin(endPin)
        {

        };

        void Tick()
        {
            m_EndPin->m_Value = m_StartPin->m_Value;
        };

    };

};
